#include <bits/stdc++.h>
using namespace std;

const int MAX_NODES = 10010;
int n;
int chess[MAX_NODES][MAX_NODES] = {0};
vector<pair<int, int>> res;

bool check(){
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(chess[i][j] == 0) continue;
            bool flag_1 = true, flag_2 = true, flag_3 = true, flag_4 = true;
            bool flag_5 = true, flag_6 = true, flag_7 = true, flag_8 = true;
            for(int k = 1; k <= 4; ++k){
                if(i - k < 0 || chess[i - k][j] != 1) flag_1 = false;
                if(i + k >= n || chess[i + k][j] != 1) flag_2 = false;
                if(j - k < 0 || chess[i][j - k] != 1) flag_3 = false;
                if(j + k >= n || chess[i][j + k] != 1) flag_4 = false;
                if(i - k < 0 || j - k < 0 || chess[i - k][j - k] != 1) flag_5 = false;
                if(i + k >= n || j + k >= n || chess[i + k][j + k] != 1) flag_6 = false;
                if(i - k < 0 || j + k >= n || chess[i - k][j + k] != 1) flag_7 = false;
                if(i + k >= n || j - k < 0 || chess[i + k][j - k] != 1) flag_8 = false;
            }
            if(flag_1 || flag_2 || flag_3 || flag_4 || flag_5 || flag_6 || flag_7 || flag_8)
                return true;
        }
    }
    return false;
}


int main(int argc, char const *argv[])
{
    freopen("五子棋.txt", "r", stdin);

    cin >> n;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j)
            cin >> chess[i][j];
    }
    
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(chess[i][j] == 1) continue;

            chess[i][j] = 1;
            if(check()) res.emplace_back(i, j);
            chess[i][j] = 0;
        }
    }
    

    for(auto e: res)
        cout << e.first << " " << e.second << endl;


    // for(int i = 0; i < n; ++i){
    //     for(int j = 0; j < n; ++j)
    //         cout << chess[i][j] << " ";
    //     cout << endl;
    // }
    return 0;
}

